﻿package kliment.utils {
	
	/**
	 * ...
	 * @author Kliment
	 * 
	 * 
	 */
	public class CollectSequence {	
		private var _sequence:Array;
		private var _ignores:Array;
		
		private var _waitIndex:int = 0;
		
		public function CollectSequence(sequence:Array, ignores:Array = null):void {
			_sequence = sequence;
			_ignores = ignores;
		}
		
		public function add(status:String):void {
			for (var i in _ignores)
				if (status == _ignores[i])
					return;
			if (status == _sequence[0]) {
				_waitIndex = 1;
			}
			if (status == _sequence[_waitIndex]) {
				_waitIndex++;
			}
		}
		
		public function get ready():Boolean {
			if (_sequence.length == _waitIndex)
				return true;
			return false;
		}
	}
	
}